STEP 7: We will follow the same steps to create a random y-coordinate.

  • Click the LOGIC tab in the toolkit, click and drag out Random Integer.
  • Change the variable name from my_var to emma_y.
  • Change the integers in the parentheses from 1,10 to -230, 230

This will create a random integer between -230 & 230 that we will use as Emma's y-coordinate.

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("schoolentrance") stage.wait(2) stage.create_grid_overlay(50, "blue") stage.set_background_color("azure") emma = codesters.Sprite("person1") emma.set_size(0.5) michael = codesters.Sprite("person2") michael.set_size(0.5) emma_x = random.randint(-230,230)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)